#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "videoview.h"
#include <QGridLayout>


MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    m_ui(new Ui::MainWindow)
{
    m_ui->setupUi(this);

    lessonSelectionWidget();//calling the lessonselection widget
    connect(m_ui->actionLessons_Creation,SIGNAL(triggered()),this,SLOT(lessonCreationWidget()));//connecting slots
    connect(m_ui->actionLesson_Selection,SIGNAL(triggered()),this,SLOT(lessonSelectionWidget()));//connecting slots
    connect(m_ui->actionVideo_View, SIGNAL(triggered()),this,SLOT(videoViewWidget()));//connecting slots
    connect(m_ui->actionUser_Selection,SIGNAL(triggered()),this,SLOT(userSelection()));//connecting slots
    m_ui->lessonSelect->setVisible(false);//setting the Lesson select window invisible
    m_ui->userSelect->setVisible(true);//setting the user select window visible
    m_ui->actionUser_Selection->setVisible(false);//setting the action menue for the user select invisible
    userSelection();//calling the user select function
}

MainWindow::~MainWindow()
{
    delete m_ui;
}
/*
setting the various vindow and action menuse visible and invisible depending on the current view
*/
void MainWindow::lessonSelectionWidget()
{
    m_ui->lessonSelect->setVisible(true);
    m_ui->videos->setVisible(false);
    m_ui->lessonCreation->setVisible(false);
    m_ui->userSelect->setVisible(false);

    m_ui->actionUser_Selection->setVisible(true);
    m_ui->actionLessons_Creation->setVisible(true);
    m_ui->actionLesson_Selection->setVisible(false);
    m_ui->actionVideo_View->setVisible(true);
}
/*
setting the various vindow and action menuse visible and invisible depending on the current view
*/
void MainWindow::lessonCreationWidget()
{
    m_ui->lessonSelect->setVisible(false);
    m_ui->videos->setVisible(false);
    m_ui->lessonCreation->setVisible(true);
    m_ui->userSelect->setVisible(false);

    m_ui->actionUser_Selection->setVisible(true);
    m_ui->actionLessons_Creation->setVisible(false);
    m_ui->actionLesson_Selection->setVisible(true);
    m_ui->actionVideo_View->setVisible(true);
}
/*
setting the various vindow and action menuse visible and invisible depending on the current view
*/
void MainWindow::videoViewWidget()
{
    m_ui->lessonSelect->setVisible(false);
    m_ui->videos->setVisible(true);
    m_ui->lessonCreation->setVisible(false);
    m_ui->userSelect->setVisible(false);

    m_ui->actionUser_Selection->setVisible(true);
    m_ui->actionLessons_Creation->setVisible(true);
    m_ui->actionLesson_Selection->setVisible(true);
    m_ui->actionVideo_View->setVisible(false);
}
/*
setting the various vindow and action menuse visible and invisible depending on the current view
*/
void MainWindow::userSelection()
{
    m_ui->lessonSelect->setVisible(false);
    m_ui->videos->setVisible(false);
    m_ui->lessonCreation->setVisible(false);
    m_ui->userSelect->setVisible(true);

    m_ui->actionUser_Selection->setVisible(false);
    m_ui->actionLessons_Creation->setVisible(true);
    m_ui->actionLesson_Selection->setVisible(true);
    m_ui->actionVideo_View->setVisible(true);
}

void MainWindow::changeEvent(QEvent *e)
{
    QMainWindow::changeEvent(e);
    switch (e->type()) {
    case QEvent::LanguageChange:
        m_ui->retranslateUi(this);
        break;
    default:
        break;
    }
}
